#include <stdio.h>

int main()
{
    int b;
    while (scanf("%d", &b) != EOF)
    {
        for (int i = 0; i < b; i++)
        {
            for (int j = 0; j < b; j++)
            {
                if (i == 0 || i == b - 1 || j == 0 || j == b - 1)
                {
                    printf("* ");
                }
                else
                {
                    printf("  ");
                }


            }
            printf("\n");
        }

    }

    return 0;
}
